package com.iris.live.services.services;

import com.iris.live.services.data.models.*;
import com.iris.live.services.models.PageData;
import com.iris.live.services.models.RequestBase;
import com.iris.live.services.models.ResultData;
import com.mysql.jdbc.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface SetService {
    List getRootByRole(String permit);

    List getAllLshRole();

    boolean deleteAllRoleItem(String permit);

    boolean insertRoleItem(RoleItemModel roleItem);

    PageData getAllCarPolicy(GetCarPolicyRequest carPolicyReq);

    int saveCarPolicy(List<AttachmentPolicyModel> policyModelList);

    boolean deleteCarPolicy(String engCode, String permit);

    List getAllCarDetailInfo();

    List getAllCarTypeInfo();

    List getCarColorByCarType(String carParam);

    List getCarColorAndAppearance();

    int saveCarPolicyWithDel(List<AttachmentPolicyModel> policyModelList);

    List getDisplayFlowInfo(String permit, Date startDate, Date endDate);

    List getItaskSetItems(String permit, String setItem);

    int saveItaskData(List<Itask基础设置Model> itaskDataModel);

    List filterCarType(String permit, String userName);

    ResultData saveDepositStatus(inOutAccountRequest accRequset, String permit);

    String saveBatchSnpSettingData(String permit, List<SNPSettingRequest> snpDataList);

    PageData getSNPDataByYM(GetSNPSettingReq snpSettingReq);

    PageData getUnSaleUserReq(unSaleUserRequest unSaleUserReq);

    int getUnSaleUserNum(unSaleUserRequest unSaleUserReq);

    boolean deleteUser(String username);

    ResultData saveUser(用户Model userData, String state);

    boolean findUserByName(String username);

    List getSaleGroupName(String permit);

    PageData getWorkFlow(workFlowRequest workFlowReq);

    int saveWorkFlowInfo(List<PushApprovalWorkFlowModel> workFlowModelList);

    PageData getLshCarProInfo(@RequestBody permitRequest permitReq);

    int saveCarProInfo(List<Lsh随车项目设置Model> carProModelList) throws IOException, ClassNotFoundException, ParseException;

    PageData getInOutAccount(inOutAccountRequest accRequset, String permit);


    PageData getDepositList(inOutAccountRequest accRequset, String permit);


    ResultData updateCallInDetail(updateCallInDetail callInModel, String liveusername);

    ResultData updateCallOutDetail(updateCallOutDetail callOutModel, String liveusername);

    List getMaxEntryNumber();

    boolean saveDealerAttachmentPloicy(DealerAttachmentPolicyModel model);

    boolean updDealerAttachmentPolicyStatu(String status, Integer id,
                                           String permit);

    PageData getDealerAttachmentPolicy(GetDAttachmentPolicyListRequest request);

    List getDistributorInfo(String permitBMBS);

    boolean updDealerAttachmentPolicyStatu(Lsh市场设置Model model);

    boolean saveDealerAttachmentPolicyStatu(Lsh市场设置Model model);

    PageData getLSHMarketSetting(GetLSHMarketSettingListRequest request);

    List getUserPassword(UserInfoRequest request);

    boolean updUserPassword(UserInfoRequest request);

    List getUpdAcountAndTime(String permit,Integer siType);

    boolean delIncomeAdjustmentById(Integer id,Integer siType);

    List getIncomeAdjustmentInfoByFrameNum(GetIncomeAdjustmentInfoByFrameNumRequest request, Integer siType );

    PageData getIncomeAdjustmentInfoBySi(GetIncomeAdjustmentByConditionRequest request);

    List getIncomeAdjustmentInfoBySiInit(String permit, String id);

    boolean saveIncomeAdjustmentInfo(List<IncomeAdjustmentModel> list, Integer siType, String userName, String permit);

    PageData getIncomeAdjustmentByCondition(
            GetIncomeAdjustmentByConditionRequest request, Integer siType);

    PageData getNewCarSaleDetailInfo(String quotedPrice,String quoteId);


    boolean updNewCarSaleInfo(销售收款详单Model model);

    boolean updNewCarStatu(UpdNewCarStatuRequest request);

    List getSaleItemsSetting(String permit,
                             String setItems);

    boolean saveSaleItemsSetting(List<销售项目设置Model> list);

    boolean isRoleName(String userName);

    Boolean saveApprovalUser(PushApprovalItemSettingModel model);

	ResultData updateNewCarSaleMoney(String onCredit,String realPay, String finance, int quoteNo, String account, String customerName, String salesInfo, String carType, String permit);

    ResultData updateNewCarSaleMoneyForNewFinance(int quoteNo,String salesInfo,String permit);

    ResultData saveApprovalUserList(List<PushApprovalItemSettingModel> modelList);

    List<String> getLshProCode(String siCode, String permit);

    boolean delCarPolicyByItemNo(String engCode, String itemNo);

    List getCarColorByCarTypeCode(int carTypeCode);

    List getNoCarIncomeAdjustmentInfo(String permit, String id);

    PageData getJiTuanSourceInfo(GetLSHMarketSettingListRequest request);

    boolean delDealerAttachmentPloicy(DelDealerAttachmentPloicyRequest request);

    List getCarLastUpdateTime();

    PageData getInvoicesList(purposeRequest payPurposeRequest, String dealer);

    List getInvoicesdetail(String VIN);

    ResultData updateInvoicesState(InvoicesState invoicesState, String liveuername, String permit);

    boolean updateInvoicesStateN(InvoicesState invoicesState, String liveuername) throws Exception;

    boolean updateInvoicesStateH(InvoicesState invoicesState, String liveuername);

    boolean updateInvoicesStateT(InvoicesState invoicesState, String liveuername);

    boolean sendInsInfo(SendInsInfo sendInsInfo, String permit, String userName);

    /**
     * create 2017-5-9  liuweilong ---------财务消息发送----------
     * @param sendInsInfo
     * @param permit
     * @return
     */
    boolean sendFinancingInfo(SendInsInfo sendInsInfo,String permit,String userName);

    ResultData getItaskDealerInfo(String permit, String username);

    String importSet(List<Map<String, Object>> list, String permit, String userName, Integer reportType)  throws Exception;

    String importBmbsSet(List<Map<String, Object>> list, String permit, String userName)  throws Exception;

    ResultData getOneUserManyAccountList();

    ResultData addOneUserManyAccount(AddOneUserManyAccountRequest request);

    ResultData delOneUserManyAccount(AddOneUserManyAccountRequest request);

    String saveSiNonVehicle(SiNonVehicle siNonVehicle, String permit, String userName)  throws Exception;

    String updateSiNonVehicle(SiNonVehicleUpdate siNonVehicle, String permit, String userName, Integer pNum)  throws Exception;

    ResultData getDealerByProId(String proId);

    ResultData getAllNotLiveDealers();

    ResultData getBasicForScFollowTime(HttpServletRequest request);

    ResultData saveBasicForScFollowTime(HttpServletRequest request,Map map);

    /**
     * 线索渠道设置
     * @param itaskDataModel
     * @return
     */
    ResultData saveClueChannel(List<Itask基础设置Model> itaskDataModel);

    static class GetCarPolicyRequest extends RequestBase {
        public String permit;
        public String si_program_code_english;
        public String item;
        public String si_program_name_chinese;
        public String carType;
        public String si_money_max;
        public String si_money_min;
    }

    static class GetSNPSettingReq extends RequestBase {
        public String permit;
        public String ym;
    }

    static class SNPSettingRequest extends RequestBase {
        public String permit;
        public String level;
        public String carDetail;
        public String carColor;
        public String biStandardConfMSRPTaxIncluded;
        public String cashDiscountAndSICostCelling;
        public String siCost;
        public String standardConfigAreaPriceLimitSNPTaxIncluded;
        public String bmbsRetailSI;
        public String bmbsWholeSaleSI;
        public String bmbsTA;
        public String lshTA;
        public String ym;

        public BigDecimal getBiStandardConfMSRPTaxIncluded() {
            return convertDecimal(biStandardConfMSRPTaxIncluded);
        }

        public BigDecimal getCashDiscountAndSICostCelling() {
            return convertDecimal(cashDiscountAndSICostCelling);
        }

        public BigDecimal getSiCost() {
            return convertDecimal(siCost);
        }

        public BigDecimal getStandardConfigAreaPriceLimitSNPTaxIncluded() {
            return convertDecimal(standardConfigAreaPriceLimitSNPTaxIncluded);
        }

        public BigDecimal getBmbsRetailSI() {
            return convertDecimal(bmbsRetailSI);
        }

        public BigDecimal getBmbsWholeSaleSI() {
            return convertDecimal(bmbsWholeSaleSI);
        }

        public BigDecimal getBmbsTA() {
            return convertDecimal(bmbsTA);
        }

        public BigDecimal getLshTA() {
            return convertDecimal(lshTA);
        }

        private BigDecimal convertDecimal(String value) {
            return new BigDecimal(StringUtils.isNullOrEmpty(value) ? "0"
                    : value);
        }
    }

    static class permitRequest extends RequestBase {
        public String permit;
    }

    static class unSaleUserRequest extends RequestBase {
        public String permit;
        public String username;
        public String realname;
        public String mobile;
        public String role;
        public String areaPermit;
        public Integer groupType;
    }

    static class purposeRequest extends RequestBase {
        public String Purpose;//开票目的
        public String carType;//车型
        public String VIN;//车架号
        public String cusTel;//客户电话
        public String saleName;//销售顾问
        public String FinancialStatus;//财务状态
        public String startTicket;   //查票开始日期
        public String finishTicket;  //查票结束日期

    }

    static class VINRequest extends RequestBase {
        public String VIN;
    }

    static class JCid extends RequestBase {
        public String jcID;
    }

    static class InvoicesState extends RequestBase {
        public String VIN;//车架号
        /*public String paymentState;//金融客户首付款状态
        public String carType;//车辆类型
        public String factoryModel;//厂牌型号
        public String origin;//产地
        public String  importID;//进口证明书号
        public String qualifiedID;//合格证号
        public String cinID;//商检单号*/
        public String remark;//开票备注
        public String invoiceDate;//实际开票日期
    }

    static class inOutAccountRequest extends RequestBase {
        public String payPurpose;
        public String carSellType;
        public String carType;
        public String carId;
        public String intelFlowStatus;
        public String name;
        public String   paymentPurpose;//(付款目的)(精确查询)
        public String saleType;//(销售类型)(精确查询)
        public String  IntentionalVehicle;//(意向车型)(模糊查询)
        public String  vin;//(车架号)(模糊查询)
        public String  newCarSaleStatus;//(新车销售状态)(精确查询)
        public String cusName;//

        public String  carSaleType;
        public String  id;
        public String onCredit; // 是否挂账
    }

    static class workFlowRequest extends RequestBase {
        public String permit;
        public String username;
    }

    static class GetDAttachmentPolicyListRequest extends RequestBase {
        public String permit;
        public String department;
        public String item;
        public String 车型;
        public String ncType;
    }

    static class GetLSHMarketSettingListRequest extends RequestBase {
        public String permit;
        public String channel;
        public String sourceType;//来源分类
    }

    static class UserInfoRequest extends RequestBase {
        public String password;
        public String userName;
    }

    static class GetIncomeAdjustmentByConditionRequest extends RequestBase {
        public String permit;
        public String shengchanId;// 生产编号
        public String customerName;// 客户姓名
        public String openTicketDate;// 开票日期
        public String jibie;// 级别
        public String carModel;// 车型
        public String carVINCode;// 车架号
        public String type;// 调整类型,1-车辆，2-月，3-季度，4-年
    }

    // UPDATE `财务详单` SET `付款目的` = '全款到账', `最近更新时间` = '%s', `上次编辑账户` = '%s' WHERE
    // VIN = '%s';
    static class UpdNewCarStatuRequest extends RequestBase {
        public String payGoal;// 付款目的
        public Timestamp recentUpdTime;// 最近更新时间
        public String lasUpdAccount;// 上次编辑账户
        public String vin;// VIN
    }

	static class GetSaleItemsSettingRequest extends RequestBase {
		public String permit;
		public String setItems;
	}

    class upNewCarSaleMoneyReq extends RequestBase {
        public String realPay;      //实付金额
        public String finance;      //财务备注
        public Integer quoteNo;     //报价编号
        public String customerName; //顾客姓名
        public String salesInfo;    //销售顾问
        public String carType;      //车款
        public String onCredit;    // 是否挂账
    }

    static class GetIncomeAdjustmentInfoByFrameNumRequest extends RequestBase {
        public String permit;
        public String frameNum;
    }

    static class DelDealerAttachmentPloicyRequest extends RequestBase {
        public String permit;
        public Integer itemCount;
    }

    static class updateCallOutDetail extends RequestBase {
        public int id;
        public String 许可;
        public String vin;
        public BigDecimal 调车款项实收金额;
        public Date 调车款项实收日期;
        public Timestamp 最近更新时间;
        public String 上次编辑账户;
    }

    static class updateCallInDetail extends RequestBase {
        public int id;
        public String 许可;
        public String vin;
        public BigDecimal 调车款项实付金额;
        public Date 调车款项实付日期;
        public Timestamp 最近更新时间;
        public String 上次编辑账户;
    }

    class SendInsInfo {
        public String salesCode;//销售顾问号
        public String state;//状态
        public String cusName;//顾客名
        public String teleNumber;//顾客电话
    }

    static class SiNonVehicle {
       public Integer carCode;//车型ID
       public String setType;//调整类型
       public String setTime;//调整时间
       public BigDecimal W;//批售
       public BigDecimal R;//零售
       public BigDecimal I;//保险
       public BigDecimal PT;//购置税
       public BigDecimal SSSC;//sssc
       public BigDecimal RT;//旅游礼包
       public BigDecimal SD;//SD
       public BigDecimal FV;//加油卡
       public BigDecimal CG;//实物礼品
       public BigDecimal SC;//服务礼券
       public BigDecimal F;//金融贴息
    }

    static class SiNonVehicleUpdate {
        public Integer pNum;//车型ID
        public BigDecimal W;//批售
        public BigDecimal R;//零售
        public BigDecimal I;//保险
        public BigDecimal PT;//购置税
        public BigDecimal SSSC;//sssc
        public BigDecimal RT;//旅游礼包
        public BigDecimal SD;//SD
        public BigDecimal FV;//加油卡
        public BigDecimal CG;//实物礼品
        public BigDecimal SC;//服务礼券
        public BigDecimal F;//金融贴息
    }

    class AddOneUserManyAccountRequest {
        public String userMail;
        public String approvalGroup;
    }

}
